#pragma once
#include <thread>
#include <atomic>
#include <functional>

class CThread
{
public:
	CThread();
	virtual ~CThread();

	void Start();
//	void Start(void* (*ThreadFun) (void*), void* arg);
	void Start(const std::function<void()> func);
	void Start(const std::function<void()> func, void* arg);
	std::thread::id GetId();
	void Interrupt();
	bool IsInterrupted();
	void Stop();
	virtual void Run();

private:
	std::atomic<bool> M_bIsInterript;
	std::thread  m_Th;
	std::function<void()> _func;
	void* m_arg;
};